import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("今日 ${_getNoon()}"),
      ),
      body: Center(
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          Container(
            decoration: BoxDecoration(),
            alignment: Alignment.center,
            margin: EdgeInsets.only(bottom: 50),
            child: Text(
              "中午项目\n ${_getNoonPro()}",
              style: const TextStyle(
                fontSize: 30,
              ),
            ),
          ),
          Container(
            decoration: BoxDecoration(color: Colors.black),
            width: MediaQuery.of(context).size.width,
            height: 1,
          ),
          Container(
            child: Text(
              "晚上项目\n ${_getNightPro()}",
              style: const TextStyle(
                fontSize: 30,
              ),
            ),
            margin: EdgeInsets.only(top: 50),
          )
        ]),
      ),
    );
  }

  String _getNoonPro() {
    var pro = "";
    // 定义一个数组来映射星期几的名称
    switch (_getNoon()) {
      case '星期一':
        pro = "肩膀 有氧10min";
        break;
      case '星期二':
        pro = "腿 有氧10min";
        break;
      case '星期三':
        pro = "背  有氧10min";
        break;
      case '星期四':
        pro = "胳膊 有氧10min";
        break;
      case '星期五':
        pro = "胸 有氧10min";
        break;
      case '星期六':
        pro = "肩 背 腿";
        break;
      case '星期日':
        pro = "胳膊  胸 背";
        break;
    }
    return pro;
  }

  /// 获取周几
  String _getNoon() {
    // 获取今天的日期
    DateTime today = DateTime.now();
    // 获取今天是周几 (1 = Monday, 7 = Sunday)
    int weekday = today.weekday;

    // 定义一个数组来映射星期几的名称
    List<String> weekdays = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'];
    return weekdays[weekday - 1];
  }

  String _getNightPro() {
    var pro = "";
    // 定义一个数组来映射星期几的名称
    switch (_getNoon()) {
      case '星期一':
        pro = "有氧";
        break;
      case '星期二':
        pro = "胳膊  胸";
        break;
      case '星期三':
        pro = "有氧";
        break;
      case '星期四':
        pro = "胸 背";
        break;
      case '星期五':
        pro = "有氧";
        break;
      case '星期六':
        pro = "有氧";
        break;
      case '星期日':
        pro = "有氧";
        break;
    }
    return pro;
  }

//todo 抖音地址
  String jianUrl = "";
  String beiUrl = "";
  String tuiUrl = "";
  String geboUrl = "";
  String xiongUrl = "";
}
